<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
.vdiInfoCreateSpan {
	background-color : lightGray;
	width : 100%;
	line-height : 25px;
	font-size : 14px;
	font-weight : bold;
}
.menuContent {
	border:1px solid black;
	display:none;
	background-color:white;
	width:313px;
	height:300px;
	position:absolute;
	z-index:9999;
	overflow:auto;
}
option {
	height: 32px;
	line-height:32px;
	font-size:14px;
	
}
option:hover {
	background-color:#4499EE;
}
option:selected {
	background-color:#3265e8;
}
</style>
<link rel="stylesheet" href="${ctx}/res/js/thirdParty/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="${ctx}/res/js/thirdParty/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="${ctx}/res/js/business/vdiManagementSystem/vdiManagement/addVdiInfoDetail.js"></script>
<script type="text/javascript">
$(function(){
	if(''!='${vdiId}' && 'null'!='${vdiId}')
	{
		setUpdateValue();
	}
});

/**
 * 显示选择框中的信息 
 */
function setUpdateValue()
{
	var systemName = "${systems}".split(",");
	var listUser = "${usernames}".split(",");
	var listUserName = "${cnusers}".split(",");
	
	if(systemName.length > 0 && systemName[0] != '')
	{
		showSystem(systemName);
	}
	
	if(listUser.length > 0 && listUser[0] != '')
	{
		showUser(listUserName,listUser);
	}
}
/**
 * 显示选择的系统信息（编辑时使用）
 */
function showSystem(systemName)
{
	var selectVal = document.getElementById('selectedSys');
	for(var i = 0; i < systemName.length ; i++)
	{
		var spanTag = document.createElement("span"); 
	    spanTag.className = "dynamicSpan";    
	    spanTag.innerHTML = systemName[i] ;  
	    document.getElementById('selectedSys').appendChild(spanTag);
	}
}
/**
 * 显示选择的用户信息（编辑时使用）
 */
function showUser(listUserName,listUser)
{
	var selectVal = document.getElementById('selected');
	for(var i = 0; i < listUser.length ; i++)
	{
		var spanTag = document.createElement("span"); 
	    spanTag.className = "dynamicSpan";    
	    spanTag.innerHTML = listUserName[i] + " / " + listUser[i] + " ";  
	    document.getElementById('selected').appendChild(spanTag); 
	}
}
</script>
</head>
<body>
	<!-- <div id="pageName" class="pageName"></div>
	<div class="vdiInfoCreateSpan">Create VDI Message</div>	 -->
		
		
	<div id="form_data" class="form_data" style="min-height:648px;margin-top:10px;">
		<div style="height: 30px; width:100%">
				<center>
				<form action="${ctx}/vdiManagement/addOrUpdateVDI.do"></form>
				<table>
					<tr>
						<td class="td_for_label"><label for="ip">IP<span style="color:red">&nbsp*</span></label>
						<input type="hidden" id="vdi_id" value="${vdiBase.id}">
						<input type="hidden" id="dept_id" value="${vdiBase.department}"></td>
						<td class="td_for_input"><input type="text" id="ip" name="ip" width="130px" value="${vdiBase.ip}">
						<span class="validate-input-error validate-tooltip validate-tooltip-inner" style="display: none; opacity: 0.8;max-width:80px;position:relative">请输入IP</span>
						</td>
						
						<td class="td_for_label"><label for="loginName">LOGIN_NAME<span style="color:red">&nbsp*</span></label></td>
						<td class="td_for_input">
						<c:choose>
							<c:when test="${vdiBase.loginName != null }"> 
						   		<input type="text" id="loginName" name="loginName" width="130px" value="${vdiBase.loginName}" readonly=ture disabled="disabled" style="background-color: lightGrey;">
						    </c:when> 
						    <c:otherwise>
						   		<input type="text" id="loginName" name="loginName" width="130px" value="${vdiBase.loginName}">
						    </c:otherwise>  
							</c:choose>
						<span class="validate-input-error validate-tooltip validate-tooltip-inner" style="display: none; opacity: 0.8;max-width:150px;position:relative">请输入登录名</span>
						</td>
					</tr>
					<tr>
						<td class="td_for_label"><label for="password">PASSWORD<span style="color:red">&nbsp*</span></label></td>
						<td class="td_for_input"><input type="text" id="password" name="password" width="130px"  value="${vdiBase.password}">
						<span class="validate-input-error validate-tooltip validate-tooltip-inner" style="display: none; opacity: 0.8;max-width:80px;position:relative">请输入密码</span>
						</td>
						
						<td class="td_for_label"><label for="computerName">COMPUTER_NAME </label></td>
						<td class="td_for_input"><input type="text" id="computerName" name="computerName" width="130px"  value="${vdiBase.computerName}">
						</td>
					</tr>
					<tr>
						<td class="td_for_label"><label for="dishSpace">DISK_SPACE </label></td>
						<td class="td_for_input"><input type="text" id="dishSpace" name="dishSpace" width="130px"  value="${vdiBase.dishSpace}">
						<span class="validate-input-error validate-tooltip validate-tooltip-inner" style="display: none; opacity: 0.8;max-width:80px;position:relative">可用空间只能为数字</span>
						</td>
					
						<td class="td_for_label"><label for="freeSpace">FREE_SPACE </label></td>
						<td class="td_for_input"><input type="text" id="freeSpace" name="freeSpace" width="130px" value="${vdiBase.freeSpace}">
						<span class="validate-input-error validate-tooltip validate-tooltip-inner" style="display: none; opacity: 0.8;max-width:80px;position:relative">剩余空间只能为数字</span>
						</td>
					</tr>
					<tr>
						<td class="td_for_label" ><label for="dept_name">DEPT_NAME </label></td>
						<td class="td_for_input">
							<c:choose>
							<c:when test="${vdiBase.department != null }"> 
						   		<input id="dept_name" type="text" readonly name="dept_id" value="${vdiBase.department }"  onclick="showMenu(); return false;"/>
						    </c:when> 
						    <c:otherwise>
						   		<input id="dept_name" type="text" readonly name="dept_id" value="----请选择部门----"  onclick="showMenu(); return false;"/>
						    </c:otherwise>  
							</c:choose>
							
							<!-- 显示部门树 -->
							<div id="menuContent" class="menuContent" >
								<ul id="departmentTree" class="ztree" style="margin-top:0;width:310px;"></ul>
							</div>
						</td>
					
						<td class="td_for_label"><label for=""></label></td>
						<td class="td_for_input">
						</td>
					</tr>
					<tr>
						<td class="td_for_label"><label for="system">SYSTEM </label></td>
						<td class="td_for_input" colspan=3>
						<input type="hidden" id="system" name="system" value="${systemIds}">
						<div id="selectedSys" class="selected"  onclick="newSystem()" style="width:830px;height:70px;"></div>
						</td>
					
					</tr>
					
					<tr>
						<td class="td_for_label"><label for="userName">USERNAME </label></td>
						<td class="td_for_input" colspan=3>
						<input type="hidden" id="userName" name="userName" value="${usernames}">
						<div id="selected" class="selected"  onclick="newUser()" style="width:830px;height:70px;"></div>
						</td>
					
					</tr>
					<tr>
						<td class="td_for_label"><label for="remark">REMARK </label></td>
						<td class="td_for_input" colspan=3><textarea id="remark" rows="100" cols="50" style="width:820px;height:60px;" maxlength="100">${vdiBase.remark}</textarea></td>
					</tr>
					
					<tr>
						<td  style="text-align:center;padding:10px;" colspan="4"><div id="btnSubmit" class="toolButton">保存</div>
						<div id="canSubmit" class="toolButton" onclick="backToCurrentPage()">取消</div>
						</td>
					</tr>
				</table>
				<from id="submitcurrentpage" action="${ctx}/vdiManagement/vdiInfoList.do">
					<input type="hidden" name="pageType" value="lastest"/>
				</from>
		</div>
	</div>
</body>
</html>